package com.zzedu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzedu.common.utils.StringUtils;
import com.zzedu.domain.ZzFeedback;
import com.zzedu.dto.ZzFeedbackDTO;
import com.zzedu.mapper.ZzFeedbackMapper;
import com.zzedu.service.IZzFeedbackService;
import org.springframework.stereotype.Service;
/**
 * 信息反馈Service业务层处理
 *
 * @author Mr.Wang
 * @date 2025-03-09
 */
@Service
public class ZzFeedbackServiceImpl extends ServiceImpl<ZzFeedbackMapper,ZzFeedback> implements IZzFeedbackService
{

    @Override
    public LambdaQueryWrapper<ZzFeedback> buildQuery(ZzFeedbackDTO zzFeedback) {
        LambdaQueryWrapper<ZzFeedback> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzFeedback.getTitle()), ZzFeedback::getTitle, zzFeedback.getTitle());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzFeedback.getContent()), ZzFeedback::getContent, zzFeedback.getContent());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzFeedback.getFeedbackAcc()), ZzFeedback::getFeedbackAcc, zzFeedback.getFeedbackAcc());
        lambdaQueryWrapper.eq(null!=zzFeedback.getFeedbackType(), ZzFeedback::getFeedbackType, zzFeedback.getFeedbackType());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzFeedback.getFeedbackSource()), ZzFeedback::getFeedbackSource, zzFeedback.getFeedbackSource());

        lambdaQueryWrapper.orderByDesc(ZzFeedback::getId);
        return lambdaQueryWrapper;
    }
}